//
//  EpointValidateXML.m
//  EpointFrame5
//
//  Created by 李亚春 on 13-12-17.
//  Copyright (c) 2013年 Epoint. All rights reserved.
//

#import "EpointValidateXML.h"
#import "EpointStringUtil.h"
#import "TKAlertCenter.h"

@implementation EpointValidateXML

+(BOOL)validateXMLWS:(NSObject *)obj
{
    if (obj==nil) {
        [[TKAlertCenter defaultCenter] postAlertWithMessage:@"网络连接超时"];
        return NO;
    }
    else
    {
        NSString *bs = (NSString *)obj;
        NSString *ReturnInfo = [EpointStringUtil getXMLFormatedAttribute:bs :@"ReturnInfo"];
        NSString *Status = [EpointStringUtil getXMLFormatedAttribute:ReturnInfo :@"Status"];
        if([Status isEqualToString:@"True"])
        {
            return YES;
        }
        else if([Status isEqualToString:@"False"])
        {
            NSString *Description = [EpointStringUtil getXMLFormatedAttribute:ReturnInfo :@"Description"];
            Description = [Description stringByReplacingOccurrencesOfString:@"<![CDATA[" withString:@""];
            Description = [Description stringByReplacingOccurrencesOfString:@"]]>" withString:@""];
            [[TKAlertCenter defaultCenter] postAlertWithMessage:[NSString stringWithFormat:@"%@",Description]];
            return NO;
        }
        else
        {
            [[TKAlertCenter defaultCenter] postAlertWithMessage:@"请求异常"];
            return NO;
        }
    }
}

@end
